<?php
class setMod extends commonMod
{
	////显示管理后台首页
	public function index()
	{	
		// $condition['id']	= 1;
		// if(empty($_POST['do']))
		// {
		// 	$config=$this->model->table('setting')->where($condition)->find();
		// 	$this->assign('config',$config);
		// 	$this->display();
		// 	return;
		// }
		// $data['sitename']= in($_POST['web_name']);
		// $data['siteurl']= in($_POST['web_url']);
		// $data['keywords']= in($_POST['web_key']);
		// $data['description']= in($_POST['web_dec']);
		// $data['icp']	= in($_POST['icp']);
		// $data['email']	= in($_POST['email']);
		// $data['logo']		= in($_POST['pic']);
		// if($this->model->table('setting')->data($data)->where($condition)->update())
		// {
		// 	$this->success('网站设置更新成功！');
		// }
		// else
		// {
		// 	$this->error('设置失败！或您未修改任何数据！');
		// }
		require(dirname(__FILE__).'/../../config.php');//后台部分配置固定，需要重加载配置
		if(empty($_POST['do'])){
			$this->assign('config', $config);
			$this->display();
			return;
		}else{
			$config = $_POST; //接收表单数据

			$config_array = array();

			foreach($config as $key=>$value)
			{
				$config_array["config['".$key."']"] = $value;	
			}
			if(!$this->set_config($config_array))
			{
				$this->error('设置失败！或您未修改任何数据！');
			}
			else
			{
				$this->success('网站设置更新成功！');
			}
		}

	}

	public function core(){
		require(dirname(__FILE__).'/../../config.php');//后台部分配置固定，需要重加载配置
		if(empty($_POST['do'])){
			$this->assign('config', $config);
			$this->display();
			return;
		}else{
			$config = $_POST; //接收表单数据

			$config_array = array();

			foreach($config as $key=>$value)
			{
				$config_array["config['".$key."']"] = $value;	
			}
			if(!$this->set_config($config_array))
			{
				$this->error('设置失败！或您未修改任何数据！');
			}
			else
			{
				$this->success('设置更新成功！','/core');
			}
		}
	}

}
?>